package com.zxx.pattern.observerPattern.observer2;

/**
 * @author zxx on 2021/3/9
 */
public class TestObserver2 {

    public static void main(String[] args) {
        NewsOffice office = new NewsOffice();

        CustomObserver observer1 = new Person1();
        CustomObserver observer2 = new Person2();

        office.addObserver(observer1);
        office.addObserver(observer2);

        office.setNews("哈哈哈哈");
        System.out.println();
        office.setNews("这是今日头条");

        System.out.println();
        office.deleteObserver(observer1);
        office.setNews("垃圾");


    }

}
